<?php echo $this->render("header.phtml"); ?>
<label class="title">Administrator control</label>
<div class="horiz_sep">&nbsp;</div>
<?php
	$account = (object) $this->account;
	if (isset($this->errors)){
		$errors = $this->errors;
		if (key_exists("mobile_null", $errors)) $mobile_null = $errors['mobile_null'];		
		if (key_exists("mobile_exist", $errors)) $mobile_exist = $errors['mobile_exist'];
		if (key_exists("mobile_incorrect", $errors)) $mobile_incorrect = $errors['mobile_incorrect'];
		if (key_exists("password_null", $errors)) $password_null = $errors['password_null'];
		if (key_exists("fullname_null", $errors)) $fullname_null = $errors['fullname_null'];
		if (key_exists("email_incorrect", $errors)) $email_incorrect = $errors['email_incorrect'];
		if (key_exists("role_null", $errors)) $role_null = $errors['role_null'];
	}
?>
<form action="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/add" method="post">
	<table cellpadding="0" cellspacing="5" width="100%">
		<tr>	
			<td width="20%" align="right">
				<b>Account/So dien thoai:</b> 
			</td>
			<td>
				<input maxlength="12" type="text" name="usr_mobile" value="<?php echo $account->usr_mobile; ?>" style="padding:2px;"/> <font color="red" style="font-weight:bold;">*</font>
				<?php if (isset($mobile_null)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $mobile_null; ?></span>
				<?php } ?>
				<?php if (isset($mobile_exist)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $mobile_exist; ?></span>
				<?php } ?>
				<?php if (isset($mobile_incorrect)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $mobile_incorrect; ?></span>
				<?php } ?>
			</td>
		</tr>
		<tr>
			<td align="right">
				<b>Mat khau:</b>
			</td>
			<td>
				<input maxlength="32" type="password" name="usr_password" value="" style="padding:2px;"/> <font color="red" style="font-weight:bold;">*</font>
				<?php if (isset($password_null)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $password_null; ?></span>
				<?php } ?>
			</td>
		</tr>
		<tr>
			<td align="right">
				<b>Ho va ten:</b>
			</td>
			<td>
				<input maxlength="50" type="text" name="usr_fullname" value="<?php echo $account->usr_fullname; ?>" style="padding:2px;"/> <font color="red" style="font-weight:bold;">*</font>
				<?php if (isset($fullname_null)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $fullname_null; ?></span>
				<?php } ?>
			</td>
		</tr>
		<tr>
			<td align="right">
				<b>Ngay sinh</b> 
			</td>
			<td>
				<input maxlength="10" type="text" name="usr_birthday" value="<?php echo $account->usr_birthday; ?>" style="padding:2px;"/>
			</td>
		</tr>
		<tr>
			<td align="right">
				<b>Dia chi email:</b>
			</td>
			<td>
				<input maxlength="100" type="text" name="usr_email" value="<?php echo $account->usr_email; ?>" style="padding:2px;"/> 
				<?php if (isset($email_incorrect)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $email_incorrect; ?></span>
				<?php } ?>
				(ex: example@gmail.com)
			</td>
		</tr>	
		<tr>
			<td align="right">
				<b>Vi tien:</b>
			</td>
			<td>
				<input maxlength="12" type="text" name="usr_coin_amount" value="<?php echo $account->usr_coin_amount; ?>" style="padding:2px;"/> (VND)
			</td>
		</tr>
		<tr>
			<td align="right">
				<b>Role:</b>
			</td>
			<td>
				<select name="usr_role">
					<option value="<?php echo Constant::GUEST; ?>">-- Chọn --</option>
					<option value="<?php echo Constant::MEMBER; ?>"><?php echo Constant::MEMBER; ?></option>
					<option value="<?php echo Constant::EDITOR; ?>"><?php echo Constant::EDITOR; ?></option>
					<option value="<?php echo Constant::ADMINISTRATOR; ?>"><?php echo Constant::ADMINISTRATOR; ?></option>
				</select>
				<font color="red" style="font-weight:bold;">*</font>
				<?php if (isset($role_null)){ ?>
					<span style="color:red; font-weight:bold;"><?php echo $role_null; ?></span>
				<?php } ?>
			</td>
		</tr>	
		<tr>
			<td align="right">
				<b>Activated:</b>
			</td>
			<td>
			<?php 
				if ($account->usr_activated) 
					$checked = "checked";
				else 	
					$checked = ""; 
			?>
				<input type="checkbox" name="usr_activated" value="1" <?php echo $checked; ?>/>
			</td>
		</tr>		
		<tr>
			<td/>
			<td>
				<input type="submit" name="save" value="Save" />
			</td>
		</tr>
	</table>
</form>
<?php echo $this->render("footer.phtml"); ?>